package com.practice.bootdemo.jdemo;

import com.practice.bootdemo.dto.UserDto;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author :Administrator
 * @description: TODO edit class Description
 * @create date: 2021/11/25 15:39
 */
public class SetTest {

    public static void main(String[] args) {
        comparator();
    }

    public static void comparator() {
        Set<UserDto> userDtos = new HashSet();
        List<UserDto> listeners = new ArrayList<>();
        UserDto userDto=new UserDto();
        userDto.setAge(1);
        userDto.setName("aa");
        listeners.add(userDto);
        //查询发言人所关注的听众集合
        List<UserDto> speakerFollowUsers = new ArrayList<>();
        userDto=new UserDto();
        userDto.setAge(1);
        userDto.setName("aa");
        speakerFollowUsers.add(userDto);
        userDto=new UserDto();
        userDto.setAge(1);
        userDto.setName("aa3");
        speakerFollowUsers.add(userDto);
        userDtos.addAll(listeners);
        userDtos.addAll(speakerFollowUsers);
        /*for (UserDto userDto : userDtos) {
            System.out.println(userDto.getName() + " " + userDto.getAge());
        }*/
        userDtos.parallelStream().forEach(System.out :: println);
    }
}
